<?php
require('../../public/connection.php');
require('../../class/Mysql.php');
$data = (array)json_decode(file_get_contents("php://input", true));
if (empty($data["id"]) || $data["value"] > 1) {
    die(json_encode(array("code" => 400, "msg" => "格式错误", "data" => null)));
}
$edit_one_data = new Mysql();
$result = $edit_one_data->addOrEditData(
    "update todolist set finished={$data["value"]} where id={$data["id"]};"
);
die(json_encode($result));
